Skip to content

Rebasing slipher's work on my CMake and VirtualMachine code - #2018

Open
illwieckz wants to merge 15 commits into
masterfrom
illwieckz/cmake-saigo
Open

illwieckz wants to merge 15 commits into
masterfrom
illwieckz/cmake-saigo

Conversation

@illwieckz

@illwieckz illwieckz commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

So in #1986 I implemented a lot of refactors meant to makes things easier for Saigo and other things (like the ability to fallback on amd64 on box64 when armhf on arm64 doesn't work, etc.):

This deeply reworked the CMake code, and also deeply reworked the VirtualMachine code, and a whole month has been invested in that effort.

In the meantime @slipher implemented those very appreciated and very wanted and very needed PRs:

It was infinitely less constly to rebase this work over mine than the other way, so that's what this branch does: rebase @slipher's work over my branch.

So I rebased #1998, #2001, #2010 over #1986 then removed every change touching external_deps/build.sh and that made this branch. It also mean that some commits by @slipher touching external_deps/build.sh were split to only keep what was not touching it. The part touching external_deps/build.sh was also rebased but is stored in #1986.

Doing this rebasing took me 10 hours of work, doing it the other way would take many days non-stop.

Because about 5 months have passed, one thing in my commits is now useless: the work I did to turn the multiarch launcher into a generic launcher not specific to armhf or even the nacl loader. Ssuch launcher is then entirely NUKED by some greatly appreciated @slipher's commit rebased here.

Because of how intricated all those changes are, that touch the same code base, I don't want to fight the war of removing that multiarch work under the feet of the later commits just because it turned useless. Cleaning-up such mess would take additional days I don't have. Those commits are following each others properly and that's what matters the most.

Some of the work in some @slipher's commit was already done in my branch, for example almost nothing is left from the commit cmake: SAIGOSDK_ROOT configures NaCl toolchain path from #2010, because it was redundant.

illwieckz and others added 15 commits June 26, 2026 03:13
Co-authored-by: Thomas Debesse <dev@illwieckz.net>
Set up the chdir and environment variable in posix_spawn.
Fixes #1336.

Co-authored-by: Thomas Debesse <dev@illwieckz.net>
Remove cvars controlling whether the Linux bootstrap loader is used.
Never use bootstrap with the amd64 loader.
Always use bootstrap with 32-bit loaders.

Co-authored-by: Thomas Debesse <dev@illwieckz.net>
When creating a NaCl (or native exe) VM on Windows, block
evironment variables from being passed through to the 
subprocess as is done on *nix. Probably we do this since
there are NACL* variables that can disable secure sandboxing.

inheritEnvironment is always false on Windows, but I implemented
the true case anyway since it's less code than having the Q_UNUSED
and asserting it's false.
Check the Linux sysctl vm.mmap_min_addr only when using the NaCl
bootstrap (rather than always when using NaCl). Or equivalently, check
it only with 32-bit NaCl runtimes. The bootstrap fails to start when the
value is too high to due low fixed address mappings. On ARM at least,
sel_ldr proper would also fail with a too-high min address since that
disturbs the address space layout. On 64-bit there is neither the
bootstrap nor 0-based address space layout so it always works.

Co-authored-by: Thomas Debesse <dev@illwieckz.net>
Co-authored-by: Thomas Debesse <dev@illwieckz.net>
The old PNaCl toolchain has been being shipped as part of the deps
package, with the host platform for the compilers assumed to be the same
as the target platform of the deps package. Experimental Saigo support
has thus far required manually downloading the SDK. Now, make the Saigo
toolchain auto-downloadable (if USE_NACL_SAIGO=1) independently from the
target platform dependencies.  This has several advantages:
- No need to download the NaCl toolchain if you are not building NaCl.
- No need to download a useless NaCl toolchain when cross-compiling.
- Toolchain can be downloaded for host systems that don't have a deps
  package, or where the deps package being used doesn't match the real
  host system.  (The SDK is available for more systems than the deps
  package.)

The toolchain is downloaded from Github and then, like the deps package,
extracted into external_deps/.
Add external_deps/sdk-build.sh which can be used as an alternative to
auto-downloading Saigo. Like external_deps/build.sh, it builds the
dependency package and installs it to the expected location. It is a
thin wrapper around the saigo-nacl-sdk CMake build; if you need more
control it is better to use CMake directly.
Comment thread cmake/DaemonDependenciesDownload.cmake
echo "If you want to build only a subset of packages, prefer using the"
echo "${REPO_URL} CMake build directly."
echo "Some global configuration options are available via environment"
echo "variables; see ${REPO_URL}/tree/master/tools/release/build"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using tab as indentation instead of spaces we would be able to rely on bash indented heredoc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do that if you want.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Log::Warn("Disabling NaCL platform qualification on arm64 kernel architecture.");
enableQualification = false;
}
if (onArm64()) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnArm64()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants